package com.production.CoursePlatform.service;

import com.production.CoursePlatform.entity.Submission;
import com.production.CoursePlatform.mapper.SubmissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SubmissionService {
    @Autowired
    private SubmissionMapper submissionMapper;

    // 创建新的提交记录
    public int createSubmission(Submission submission) {
        return submissionMapper.insertWithoutShID(submission);
    }

    // 通过 ahID 查找提交记录
    public List<Submission> findByAhID(int ahID) {
        return submissionMapper.selectByAhID(ahID);
    }

    // 通过 shID 删除提交记录
    public int deleteSubmission(int shID) {
        return submissionMapper.deleteByShID(shID);
    }

    // 更新提交记录
    public int updateSubmission(Submission submission) {
        return submissionMapper.updateSubmission(submission);
    }
}

